#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
#   Author  :   vincent
#   E-mail  :
#   Date    :   16/02/22 11:58:20
#   Desc    :
#

class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: void Do not return anything, modify nums in-place instead.
        """
        pending_list = []
        print ('nums is:'+str(nums)+'\nnums length is: '+ str(len(nums)))
        for index,value in enumerate(nums):
            if value == 0:
                # print
                pending_list.append(value)
                nums.pop(index)

        print ('pending_list length is: '+ str(len(pending_list)))
        print ('nums length is: '+ str(len(nums)))
        for j in pending_list:
            nums.append(j)
        # nums.append(pending_list)
        print (nums)
    def moveZeros2(self,nums):
        lenght = len(nums)
        tmplist = filter(lambda x:x!=0,nums)
        del nums[:]
        for i in range(lenght):
            if i<len(tmplist):
                nums.append(tmplist[i])
            else:
                nums.append(0)
        print (nums)

a = Solution()
# b = [0,1,0,1,2,3,4,5,6,5,4,3,2,1,0]
# b = [0,1,0,0,0,0,0,0,1,2,3,4,5,6,5,4,3,2,1,0]
# c = [0,0,0,0,0,0,0,0,0,1]

d = [0,0,1,0,1,0,2,0,3,0,0,0,4,0,5,0,6,5,4,3,2,1,0]
# a.moveZeroes(b)
# a.moveZeroes(c)
a.moveZeroes(d)
a.moveZeros2(d)

